package com.training.java.core.collections.car.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TvListDemo {

	public static void main(String[] args) {
		// Creating multiple objects

		Tv television1 = new Tv("Sharp", "LED", false, 600);
		Tv television2 = new Tv("Samsung", "LCD", false, 2500);
		Tv television3 = new Tv("Sony", "LED", false, 3500);
		Tv television4 = new Tv("Sony", "LED", false, 3500);// same object with
															// different object
															// reference

		// Creating List

		List listOfTvs = new ArrayList();

		// Adding objects to list
		listOfTvs.add(television1);
		listOfTvs.add(television2);
		listOfTvs.add(television3);
		// same object with different object reference
		listOfTvs.add(television4);
		// listOfTvs.add(null);

		// Cteating iterator
		Iterator ite = listOfTvs.iterator();

		while (ite.hasNext()) {
			Tv television = (Tv) ite.next();

			System.out.println("Television company : "
					+ television.getCompany());
			System.out.println("Television type : " + television.getType());
			System.out.println("Television Enabled 3D : "
					+ television1.isEnabled3D());
			System.out.println("Television price : " + television.getPrice());

			System.out.println("*******************************************  ");

		}

	}

}
